package com.yunze.apiCommon.upstreamAPI.DongXinEc;

import com.alibaba.fastjson.JSONObject;
import com.yunze.apiCommon.utils.HttpUtil;
import com.yunze.apiCommon.utils.MD5Util;
import com.yunze.apiCommon.utils.UrlUtil;

import java.util.Map;

/**
 * 东信 EC 系统 API 接口
 */
public class DongXin_ECV2_Api {


	/**
	 *
	 * @param params   msisdn / url
 	 * @return
	 */
	public String EcV2 (Map<String,Object> params){
		JSONObject Outdata = new JSONObject();

		long time = System.currentTimeMillis();
		params.put("account", account);
		params.put("apikey", apikey);
		params.put("sign", MD5Util.MD5Encode(account+apikey+time+apikey));
		params.put("timeStamp", time);
		params.put("msisdn", params.get("msisdn"));
		params.put("ebid", ebid);
		params.remove("iccid");

		String url = server_Ip + "api/v2/OneLinkSend.do";
		//params.put("url","https://api.iot.10086.cn/v2/gprsrealtimeinfo");//请求连接
		String reqUrl = UrlUtil.getUrl(url, params);
		//System.out.println(reqUrl);
		String res = HttpUtil.get(reqUrl);

		return res;
	}


	//构造赋值
	public DongXin_ECV2_Api(Map<String, Object> init_map){

		account = init_map.get("cd_username").toString();
		apikey = init_map.get("cd_pwd").toString();
		ebid = init_map.get("cd_key").toString();

    }
	
	// 服务器请求地址
	protected  static String server_Ip = "http://47.112.121.158:9086/";
	// user_id 					  
	protected static String appId = "";
	// 秘钥密码 	
	protected static String password = null;
	// 账号名称(account)：
	protected static String account = null;
	//Key值(apikey)：
	protected static String apikey = null;
	// Sec值(apisec)：
	protected static String ebid =null;








}
